home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / cat_exe.zip / LIFE_1.CAL < prev    next >
Text File  |  1994-11-18  |  998b  |  46 lines

  1. (* Conveys LIFE program with 2 states of any cell:
  2.    dead / alive *)
  3.  
  4. RECIPE  XYSize  =  50;
  5.         XYBound =  1;
  6.         Colors =  2;
  7.         Zet    =  2;
  8.  
  9. CONST Dead   =  0;
  10.       Alive  =  1;
  11.  
  12. VAR state;
  13.  
  14. EVENT SetUp;
  15.       RingForm;
  16.       RGBPalette(Colors, $0, $FF, $32,0, $B6, 0);
  17.       PlClipActive;
  18.       ShowPlane;
  19.  
  20. EVENT E0; (* initialization of cell plane *)
  21.       PlFillRandom (Dead,Alive);
  22.       ShowPlane;
  23.  
  24. EVENT E1; (* life program *)
  25.     PARALLEL DO
  26.     state := MooreSum;
  27.                (* for performance reasons *)
  28.       IF (state = 3) OR (state = 2)
  29.         THEN IF (Self = Alive)
  30.                THEN Self := Alive
  31.                ELSE IF (state = 3)
  32.                     THEN Self := Alive
  33.                     ELSE Self := Dead
  34.                     FI
  35.              FI
  36.         ELSE Self := Dead
  37.       FI;
  38.     OD;
  39.     ShowPlane;
  40. END.
  41.  
  42. ********************************
  43. *  compilation o.k.            *
  44. ********************************
  45.  
  46.